<template>
<div>
    <div class="item" @click="urlFn(item.filmId)"
    v-for="item in nowplays" :key="item.filmId">

<div class="left">
    <img :src="item.poster" />
</div>

<div class="middle">
<div>{{ item.name }}</div>
<div><span>观众评分</span><span>{{ item.grade}}</span></div>
<div>主演：{{ item.director }}</div>
<div>{{item.nation}} | {{item.runtime}}分钟</div>
</div>
<div class="right">
    <!-- color与下边color默认值一样，写一个就可以 -->
    <span  :sytle=[{color}]>{{title}}</span></div>
   
    </div>
    </div>
</template>
<script>
export default {
    components:{

    },
    //用对象方式设定属性的默认值类型等
    props:{
        title:{
        default:'购票',
        },
        color:{
        default:"#ff5f16"
        },
        //利用父子组件传值，获取数据
        nowplays:Array

    },
    methods:{
      urlFn(id){
this.$router.push({name:"detail",params:{id}})
      }
    }

    
}
</script>
<style lang="scss" scoped>
.item{
    margin-left: 15px;
    margin-top:10px;
    display: flex;
    color: #797d82;
    font-size: 13px;
    .left{
        width: 20%;
        height:100px;
        img{
            width:100%;
            height: 100%;
        }
    }
    .middle{
        width:60%;
        margin-left: 10px;
        display: flex;
        flex-direction: column;
        align-items: left;
        justify-content: space-between;
        div:nth-of-type(1){
            color: black;
            font-size: 16px;
        }
        div:nth-of-type(3){
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
    }
    .right{
        width: 20%;
        display: flex;
         align-items: center;

        span{
        border:1px solid #ff5f16;
        border-radius: 3px;;
        font-size: 15px;
        height: 25px;
        line-height: 25px;
        width: 50px;
        text-align: center;
        color:#ff5f16 ;
        }
    }
}
</style>

   